libkovan  1
The kovan standard library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Graphics

Functions

EXPORT_SYM int graphics_open (int width, int height)
 
EXPORT_SYM void graphics_close ()
 
EXPORT_SYM void graphics_update ()
 
EXPORT_SYM void graphics_clear ()
 
EXPORT_SYM void graphics_fill (int r, int g, int b)
 
EXPORT_SYM void graphics_pixel (int x, int y, int r, int g, int b)
 
EXPORT_SYM void graphics_line (int x1, int y1, int x2, int y2, int r, int g, int b)
 
EXPORT_SYM void graphics_circle (int cx, int cy, int radius, int r, int g, int b)
 
EXPORT_SYM void graphics_circle_fill (int cx, int cy, int radius, int r, int g, int b)
 
EXPORT_SYM void graphics_rectangle (int x1, int y1, int x2, int y2, int r, int g, int b)
 
EXPORT_SYM void graphics_rectangle_fill (int x1, int y1, int x2, int y2, int r, int g, int b)
 
EXPORT_SYM void graphics_triangle (int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b)
 
EXPORT_SYM void graphics_triangle_fill (int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b)
 
EXPORT_SYM int get_key_state (enum KeyCode key)
 
EXPORT_SYM void get_mouse_position (int *x, int *y)
 
EXPORT_SYM int get_mouse_middle_button ()
 
EXPORT_SYM int get_mouse_left_button ()
 
EXPORT_SYM int get_mouse_right_button ()
 

Detailed Description

Function Documentation

EXPORT_SYM int get_key_state ( enum KeyCode  key)

Gets the current state of a keyboard key.

Note
A KISS Graphics Window must be open for input functions to work.
Parameters
keyAn ASCII key code or a Key value from the KeyCode enum.
Returns
1 for pressed, 0 for not pressed
EXPORT_SYM int get_mouse_left_button ( )

Returns the state of the mouse's left button.

Returns
1 for pressed, 0 for not pressed
EXPORT_SYM int get_mouse_middle_button ( )

Returns the state of the mouse's middle button.

Returns
1 for pressed, 0 for not pressed
EXPORT_SYM void get_mouse_position ( int *  x,
int *  y 
)

Returns the mouse's current position relative to the top left corner of the graphics window.

EXPORT_SYM int get_mouse_right_button ( )

Returns the state of the mouse's right button.

Returns
1 for pressed, 0 for not pressed
EXPORT_SYM void graphics_circle ( int  cx,
int  cy,
int  radius,
int  r,
int  g,
int  b 
)

Draw an unfilled circle to the graphics window at the given coordinates and with the given radius.

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_circle_fill ( int  cx,
int  cy,
int  radius,
int  r,
int  g,
int  b 
)

Draw a filled circle to the graphics window at the given coordinates and with the given radius.

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_clear ( )

Fills the entire window with the color black

EXPORT_SYM void graphics_close ( )

Closes the previously opened KISS Graphics Window

EXPORT_SYM void graphics_fill ( int  r,
int  g,
int  b 
)

Fill the graphics context with a color.

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_line ( int  x1,
int  y1,
int  x2,
int  y2,
int  r,
int  g,
int  b 
)

Draw a line from the point (x1, y1) to (x2, y2)

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM int graphics_open ( int  width,
int  height 
)

Opens a KISS Graphics Window for drawing and input functions.

Parameters
widthThe width of the graphics window
heightThe height of the graphics window
EXPORT_SYM void graphics_pixel ( int  x,
int  y,
int  r,
int  g,
int  b 
)

Draw a pixel at (x, y)

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_rectangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  r,
int  g,
int  b 
)

Draw an unfilled rectangle to the graphics window at the given coordinates.

Parameters
x1the X coordinate of the rectangle's top-left corner
y1the Y coordinate of the rectangle's top-left corner
x2the X coordinate of the rectangle's bottom-right corner
y2the Y coordinate of the rectangle's bottom-right corner
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_rectangle_fill ( int  x1,
int  y1,
int  x2,
int  y2,
int  r,
int  g,
int  b 
)

Draw a filled rectangle to the graphics window at the given coordinates.

Parameters
x1the X coordinate of the rectangle's top-left corner
y1the Y coordinate of the rectangle's top-left corner
x2the X coordinate of the rectangle's bottom-right corner
y2the Y coordinate of the rectangle's bottom-right corner
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_triangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
int  r,
int  g,
int  b 
)

Draw an unfilled triangle to the graphics window at the given coordinates.

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_triangle_fill ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
int  r,
int  g,
int  b 
)

Draw a filled triangle to the graphics window at the given coordinates.

Parameters
rthe red component of the drawing, from 0 to 255
gthe green component of the drawing, from 0 to 255
bthe blue component of the drawing, from 0 to 255
EXPORT_SYM void graphics_update ( )

Update must be called after drawing to the window for changes to be visible. This function also must be called regularly for input to work.